@extends('common.header')
<!DOCTYPE html>
<html>
<head>
	<!-- 1.添加meta csrf_token -->
	<meta name="csrf-token" content="{{ csrf_token() }}"> 
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="white">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>{{ $user['name'] }}-足球推荐专家的个人主页</title>
	<meta name="Description" content="@if( empty($user['desc']) ){{ $user['name'].'的个人推荐主页' }}@else{{ $user['desc'] }}@endif" />
	<link rel="stylesheet" type="text/css" href="{{ asset('/css/center/pcenter.css') }}"/>
	<script src=" {{ asset('/js/jquery-1.9.1.min.js') }} "></script>
<script>

	<!-- 2.设置全局ajax选项 -->
	$.ajaxSetup({
		headers:{
			'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
		}
	});
	
	// 获取 token
	var _token = $('meta[name="csrf-token"]').attr('content');
	
	
	// 粉丝关注
	function addFollow()
	{
		var follow = $("#user_id").attr('user_id');
		$.ajax({
			type: "post",
			url: "{{ url('/addfollow') }}",
			data: {follow_id:follow,_token: _token},
			async: true,
			dataType: "json",
			success:function (back){
				if(back['show_info']=='关注成功')
				{
					$("#follow").text("已关注");
                    window.location.reload();
					
				}else
				{
					// $("#fansTotal").html('');
					alert(back['show_info']);
				}
			}
	
		
		})
	}

	// 粉丝取消关注
    function quFollow( follow )
	{
        $.ajax({
            type: "post",
            url: "{{ url('/canclefollow') }}",
            data: {follow_id:follow,_token: _token},
            async: true,
            dataType: "json",
            success:function (back){
                if(back['show_info']=='取消关注成功')
                {
                    window.location.reload();
                }else
                {
                    alert(back['show_info']);
                }
            }

        })
    }
	
	// 取消关注
	var ishidden = '123';
	function focuson( follow_id ){
		if( ishidden=='123' )
		{
			$(".focus_hidde").show();
			ishidden = '456';
		}else
		{
			$(".focus_hidde").hide();
			ishidden = '123';
		}
	}
	
	
	
	
	// 页数等于 1
	var page = 2;
	// 是否 加载
	var isLoading = true;
	
	$(window).scroll(function()
	{
		// 窗口高度
		var wH = $(window).height();
		
		// 滚动条高度
		var sH = $(window).scrollTop();

		// 文本高度
		var dH = $(document).height();

		if(wH + sH < dH )
		{
			return;
		}

		run();

	});
	// 加载 文章
	function run()
	{
		if( !isLoading )
		{
			return;
		} 

		isLoading = false;
		var user_id = $("#user_id").attr('user_id');
		
		$.ajax({
			type: "post",
			url: "{{ url('/pubuliuArticle') }}",
			data: { page:page,user_id:user_id, _token: _token },
			async: true,
			dataType:"json",
			success:function(back)
			{
				
				if( back['show_info'] && back['show_info']=='已全部加载' )
				{
					isLoading=false;
					$("#allLoad").html("<span style='display:inline-block;width:100%;text-align:center;' >"+back['show_info']+"</span>" );
					return false;
				}
				for(i=0;i<back.length;i++)
				{
				
		var html = '';
html += "<div class='con-list detail '>";
	html += "<div class='fl'>";
		html += "<div class='det-tit'>";
			html += "<i class='tit-list'><a href=\'{{ url('/footClub') }}/"+back[i]['category_id']+"' >"+back[i]['category_name']+"</a></i>";
			html += "<a href=\'{{ url('/article') }}/"+back[i]['id']+"' style='color: #de1e30'><span> 	"+back[i]['title']+"</a>";
		html += "</div>";
		html += " <div class='det-liyou'>";
			html += "<i style='float:left'>文章简介：</i><p class='club-content'>"+back[i]['content'];                            
		    html += "</p></div>";
		html += "<div class='det-yc'>";
			html += "<span>"+back[i]['create_at']+"</span>";
		html += "</div>";
	html +=	"</div>";
	html += "<div class='fr'>";
		html += "<div class='qiubi kingCold'>";
		html += "<a class='shi' href=\'{{ url('/article') }}/"+back[i]['id']+"' >查看<i></i></a>";
		html += "</div>";
	html += "</div>";
html += "</div>";
		
		$("#allLoad").append(html);
				}
				page ++;
				isLoading = true;
			}
		});

	}

</script>
</head>
<body>

<div id="user_id" user_id="{{ $user['id'] }}" ></div>


<!--面包屑导航-->
<div style="width: 1200px;height: 40px;line-height:40px;position: relative;margin: 110px auto 0">
    <ol style="float: left;overflow: hidden;color: #333;list-style: none;">
        <li style="float: left;margin-left: 5px">当前位置：</li>
        <li style="float: left;margin-left: 5px"><a href="{{ url('/') }}" style="color: #de1e30;margin-left: 5px">首页</a></li>
        <li style="float: left;margin-left: 5px">> 个人中心  >{{ $user['name'] }}</li>
    </ol>
</div>
<div class="tj-body w">
    <div class="main clearfix">
        <!--左侧-->
        <div class="tiao-jian fl">
            <!--会员中心-->
            <div class="sai-xuan">
                <b>会员中心</b>
            </div>
            <!--会员信息-->
            <div class="new-tj">
                <div id="expertIntroductInfo" class="jian-jie clearfix">
                    <div class="fl">
                        <div class="head-bor">
                            <div class="head-img">
                                <img src="{{ $user['pic_url'] }}" id="logoUrl">
                            </div>
                        </div>
                    </div>

                    <div class="fr jian-det">
                        <i class="name">{{ $user['name'] }}</i>
						
						@if( session('user_name') )
							@if( session('user_id')==$user['id'] )
							@else
								@if( in_array( session('user_id'),$fans_arr ) )
								<div style="position:relative;display: inline-block;">
									<i class="focus" id="qufollow" onclick="focuson({{ $user['id'] }})">已关注</i>
									<div class="focus_hidde"  onclick="quFollow({{ $user['id'] }})">
										<i><span></span></i>
										<ul>
											<li><a href="#">取消关注</a></li>
										</ul>
									</div>
								</div>
								@else
								<i class="focus" id="follow" onclick="addFollow();">关注</i>
								@endif
							@endif
							
						@else
							<i class="focus" id="focus" >关注</i>	
						@endif
						
                        <div class="num">
							<!--<span>金币:<b>7</b></span><i></i>-->
                            <span>{{ $user['total'] }}中{{ $user['zhong'] }}&nbsp;&nbsp;   胜率:<b>{{ $user['shenglv'] }}</b></span><i></i>
                            <span>积分:<b>{{ $user['score'] }}</b></span>
							<i></i><span>粉丝:<b id="fansTotal">{{ $fansTotal }}</b></span>
                        </div>
                    </div>
                </div>
            </div>
            <!--竞彩，球吧-->
            <div class="today">
                <!--标题-->
                <div class="today-tit clearfix" id="today">
                    <span class="active fl">竞彩推荐</span>
                    <span class="fl">球吧文章</span>
                </div>
                <!--内容-->
                <div class="two-cons">
                    <!--竞彩推荐-->
                    <div class="today-con recommed">
					@forelse( $history as $key => $tuijian )
				
                        <!--每一项-->
                        <div class="con-list detail ">
                            <div class="fl">
                                <div class="det-tit">
                                    <i>标题 : </i><a href="{{ url('/recommenddetail') }}/{{ $tuijian->id }}" style="color: #de1e30">
                                    <span> {{ $tuijian->home }}<em>VS</em>{{ $tuijian->away }}</span></a>
                                </div>
                                <div class="det-liyou">
                                    <i style="float:left">推荐理由：</i>
									{!! $tuijian->content !!}
                                </div>
                                <div class="det-yc"><span>{{ $tuijian->create_at }}</span>
                                </div>
                            </div>
                            <div class="fr">
                                <div class="qiubi kingCold">
                                    <a class="shi" href="{{ url('/recommenddetail') }}/{{ $tuijian->id }}">查看<i></i></a>
                                </div>
                                <!--背景图片 类名zhong  为中  类名wrong  为失-->
								@if($tuijian->judge==0)
								@elseif($tuijian->judge==1)
                                <div class="wrong"></div>
								@elseif($tuijian->judge==2)
								<div class="zhong"></div>
								@else
								@endif

                            </div>
                        </div>
						@empty
						@endforelse
						<div style="width:70%;text-align:center;font-size:14px;">
						{{ $history ->links() }}
						</div>
                    </div>
                    <!--球吧文章-->
                    <div class="today-con club" id="listing">
						@forelse( $all_wenzhang as $key => $wenzhang )
					
                        <!--每一项-->
                        <div class="con-list detail ">
                            <div class="fl">
                                <!--标题-->
                                <div class="det-tit">
                                    <i class="tit-list">
									<a href="{{ url('/footClub') }}/{{ $wenzhang['category_id'] }}">{{ $wenzhang['category_name'] }}</a>
									</i><a href="{{ url('/article') }}/{{ $wenzhang['id'] }}" style="color: #de1e30">
                                    <span>{{ $wenzhang['title'] }}</span></a>
                                </div>
                                <!--文章简介-->
                                <div class="det-liyou">
                                    <i style="float:left">文章简介：</i>
									<p class="club-content">{!! $wenzhang['content'] !!}</p>
                                </div>
                                <!--发布时间-->
                                <div class="det-yc">
                                    <span> {{ $wenzhang['create_at'] }}</span>
                                </div>
                                <!--赞，平，收-->

                            </div>
                            <div class="fr">
                                <div class="qiubi kingCold">
                                    <a class="shi" href="{{ url('/article') }}/{{ $wenzhang['id'] }}">查看<i></i></a>
                                </div>

                            </div>
                        </div>
						
						@empty
						@endforelse
						
						<div id="allLoad" style="width:100%;text-align:left;font-size:16px;color:#8a8a8a" >
						</div>
						
                    </div>
                </div>

            </div>
        </div>
        <!--右侧-->
        <div class="deng-lu fr">
		
            <div class="map">
                <!--标题-->
                <div class="map-tit">胜率排行榜</div>
                <!--排行榜-->
                <div id="expertTalkBall" class="map-list">
				
				@forelse( $rank as $key => $shenglv )
		
                    <!--每一项-->
                    <a href="{{ url('/showcenter') }}/{{ $shenglv['id'] }}">
                        <div class="one-map clearfix">
                            <div class="fl head-login">
                                <div class="head-bor">
                                    <div class="head-img">
                                        <img src="{{ $shenglv['pic_url']}}">
                                    </div>
                                </div>
                            </div>
                            <div class="fl second">
                                <i class="name">{{ $shenglv['name']}}</i>
                                <span>胜率:<b>{{ $shenglv['shenglv']}}</b></span>
                            </div>
                            <div class="fr">
                                <i class="map-ico"></i>
                            </div>
                        </div>
                    </a>
                  
				@empty
				@endforelse
					
                </div>
            </div>
        </div>
    </div>
</div>
<script>
$(document).ready(function(){
	$(".today-con").eq(0).show();
	$("#today .fl").eq(0).addClass("active");
	$("#today .fl").click(function(){
		var num =$("#today .fl").index(this);
		$("#today .fl").removeClass("active");
		$(this).addClass("active");
		$(".today-con").hide();
		$(".today-con").eq(num).show().siblings().hide();
	});
	
})

</script>

@extends('common.footer')
</body>
</html>